<template>
  <router-view></router-view>
</template>

<script>
  import { mapGetters } from 'vuex'
  export default {
    name: 'environmentIndex',
    computed: {
      ...mapGetters({
        currentUser: 'currentUser'
      })
    },
    watch: {
      '$route' (to) {
        if (to.name === 'envMonitor') {
          this.push()
        }
      }
    },
    mounted () {
      this.push()
    },
    methods: {
      push () {
        if (this.currentUser.type === 1) {
          this.$router.push({name: 'companyEnvironment'})
        } else {
          this.$router.push({name: 'projectEnvironment'})
        }
      }
    }
  }
</script>
